home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Otherware
/
Otherware_1_SB_Development.iso
/
mac
/
hypercar
/
xfcn
/
spttool.cpt
/
Support Tools eXternals 1.2.5
/
card_41583.txt
< prev
next >
Wrap
Text File
|
1990-11-13
|
7KB
|
202 lines
-- card: 41583 from stack: in.5
-- bmap block id: 46055
-- flags: 0000
-- background id: 3858
-- name: VolumeList
----- HyperTalk script -----
on CloseCard
put empty into cd fld "volume list"
put empty into cd fld "label"
set the scroll of cd fld "volume list" to 0
pass CloseCard
end CloseCard
on HideObjects
hide cd fld "volume list"
hide cd fld "label"
hide cd btn "try it!"
end HideObjects
on ShowObjects
show cd fld "volume list"
show cd fld "label"
show cd btn "try it!"
end ShowObjects
-- part 1 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=82 top=292 right=326 bottom=175
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 8192
-- line height: 16
-- part name: Try It!
----- HyperTalk script -----
on mouseUp
global errGlobal
put VolumeList(newVolume, "noDialog:errGlobal") into volumes
if errGlobal Γëá empty then
answer "Error:" && errGlobal
put empty into errGlobal
else
put volumes into cd fld "volume list"
put "Currently mounted volumes" into cd fld "label"
end if
end mouseUp
-- part 2 (field)
-- low flags: 00
-- high flags: 0007
-- rect: left=19 top=117 right=288 bottom=236
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 4
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: volume list
-- part 3 (field)
-- low flags: 00
-- high flags: 0000
-- rect: left=19 top=101 right=118 bottom=236
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 256
-- line height: 12
-- part name: label
-- part contents for background part 38
----- text -----
49/50
-- part contents for background part 20
----- text -----
An XFCN which returns a carraige return delimited list of all currently mounted volumes.
Calling syntax : VolumeList(<"noDialog:"errorGlobal>)
-- part contents for background part 42
----- text -----
{ VolumeList( ) }
{ XFCN returns a CR delimited list of the names of all }
{ mounted volumes. }
{}
{ brought to you by: Anup Murarka Eric Carlson }
{ ALINK: SKEPTIC ALINK: cyNic }
{ CIS: 76004,3356 }
{}
{ We are part of the Support Tools Development Group, }
{ Apple Computer, Inc. }
{}
{ please DO NOT contack Mac DTS for support of this code! }
{}
{ please DO contact the authors for support of this code! }
{}
{ Send comments, bug reports, requests to any of the above }
{ E-mail addresses or to:}
{}
{ (one of us) }
{ Apple Computer, Inc. }
{ 900 E. Hamilton, Ave. }
{ Campbell, CA 95008 }
{ M/S 72-L }
{}
{ Copyright: © 1989, 1990 by Apple Computer, Inc., all rights reserved. }
{}
{ written by Eric Carlson }
{ AppleLink: cyNic }
{ modification history }
{ Date Initials Comments }
{ ---- ------ ------------------------------------------------}
{ 12/16/89 ec first written }
{ 6/3/90 ec additonal comments }
{}
unit VolumeList;
interface
uses
hyperXCmd;
procedure MAIN (paramPtr: XCmdPtr);
implementation
function askedForHelp (paramPtr: XCmdPtr;
syntaxMsg: Str255;
copyRightMsg: Str255): boolean;
{}
{ check to see if the user sent a '?' or a '!' as }
{ the only parameter. if so we will respond with }
{ the calling syntax or the copyright/version info }
{ for this external }
{}
var
firstStr: str255;
begin
askedForHelp := false;
if paramPtr^.paramCount = 1 then
begin
ZeroToPas(paramPtr, paramPtr^.params[1]^, firstStr);
{ what is the first param? }
if firstStr = '?' then
begin
paramPtr^.returnValue := PasToZero(paramPtr, syntaxMsg);
askedForHelp := true
end { asked for help }
else if firstStr = '!' then
begin
paramPtr^.returnValue := PasToZero(paramPtr, copyRightMsg);
askedForHelp := true
end; { asked for copyright info }
end; { one parameter passed }
end; { function }
procedure VolumeList (paramPtr: XCmdPtr);
var
volList, volName: str255;
PB: ParamBlockRec;
volInfoErr: OSErr;
begin
if askedForHelp(paramPtr, 'VolumeList()', '©1989, 1990 Apple Computer, Inc., v1.0 by Eric Carlson') then
exit(VolumeList);
zeroBytes(paramPtr, @PB, sizeOf(PB)); { clear out our paramblock }
PB.ioNamePtr := @volName; { where to stick the vol name }
PB.ioVolIndex := 1; { start with the first mounted vol }
volList := '';
volInfoErr := PBGetVInfo(@PB, false); { get the first volume name }
while (volInfoErr = noErr) do { loop through all volumes }
begin
volList := concat(volList, volName, ':', chr(13)); { remember it, add a colon }
PB.ioVolIndex := PB.ioVolIndex + 1; { next volume }
volInfoErr := PBGetVInfo(@PB, false); { get the next volume name }
end;
if length(volList) > 0 then
volList := Omit(volList, length(volList), 1); { drop the trailing CR }
paramPtr^.returnValue := PasToZero(paramPtr, volList); { return the list }
end; { procedure volumeList}
procedure MAIN (paramPtr: XCmdPtr);
begin
VolumeList(paramPtr);
end;
end. { unit VolumeList}